home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / QuickDraw 3D / Windows files / Q3WinSDK.exe / QD3DSDK / Interfaces / QD3DView.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-12-20  |  13.7 KB  |  406 lines

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DView.h                                                 **
  4.  **                                                                             **
  5.  **                                                                             **
  6.  **     Purpose:     View types and routines                                     **
  7.  **                                                                             **
  8.  **                                                                             **
  9.  **                                                                             **
  10.  **     Copyright (C) 1992-1996 Apple Computer, Inc.  All rights reserved.     **
  11.  **                                                                             **
  12.  **                                                                             **
  13.  *****************************************************************************/
  14. #ifndef QD3DView_h
  15. #define QD3DView_h
  16.  
  17. #if defined(PRAGMA_ONCE) && PRAGMA_ONCE
  18.     #pragma once
  19. #endif  /*  PRAGMA_ONCE  */
  20.  
  21. #include "QD3DStyle.h"
  22. #include "QD3DSet.h"
  23.  
  24. #if defined(THINK_C) || defined(__SC__)
  25.     #pragma options(!pack_enums, !align_arrays)
  26.     #pragma SC options align=power
  27. #elif defined(__MWERKS__)
  28.     #pragma enumsalwaysint on
  29.     #pragma align_array_members off
  30.     #pragma options align=native
  31. #elif defined(__PPCC__)
  32.     #pragma options align=power
  33. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  34.     #pragma options enum=int
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif    /* __cplusplus */
  40.  
  41.  
  42. /******************************************************************************
  43.  **                                                                             **
  44.  **                        View Type Definitions                                 **
  45.  **                                                                             **
  46.  *****************************************************************************/
  47.  
  48. typedef enum TQ3ViewStatus {
  49.     kQ3ViewStatusDone,
  50.     kQ3ViewStatusRetraverse,
  51.     kQ3ViewStatusError,
  52.     kQ3ViewStatusCancelled
  53. } TQ3ViewStatus;
  54.  
  55. /******************************************************************************
  56.  **                                                                             **
  57.  **                        View Rendering routines                                 **
  58.  **                                                                             **
  59.  *****************************************************************************/
  60.  
  61. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_SetRendererByType(
  62.     TQ3ViewObject         view,
  63.     TQ3ObjectType         type);
  64.     
  65. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_SetRenderer(
  66.     TQ3ViewObject         view,
  67.     TQ3RendererObject    renderer);
  68.  
  69. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_GetRenderer(
  70.     TQ3ViewObject        view,
  71.     TQ3RendererObject    *renderer);
  72.     
  73. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_StartRendering(
  74.     TQ3ViewObject         view);
  75.     
  76. QD3D_EXPORT TQ3ViewStatus QD3D_CALL Q3View_EndRendering(
  77.     TQ3ViewObject         view);
  78.     
  79. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_Flush(
  80.     TQ3ViewObject        view);
  81.     
  82. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_Sync(
  83.     TQ3ViewObject        view);
  84.  
  85. /******************************************************************************
  86.  **                                                                             **
  87.  **                        View/Bounds/Pick routines                             **
  88.  **                                                                             **
  89.  *****************************************************************************/
  90.  
  91. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_StartBoundingBox(
  92.     TQ3ViewObject        view,
  93.     TQ3ComputeBounds    computeBounds);
  94.  
  95. QD3D_EXPORT TQ3ViewStatus QD3D_CALL Q3View_EndBoundingBox(
  96.     TQ3ViewObject        view,
  97.     TQ3BoundingBox        *result);
  98.  
  99. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_StartBoundingSphere(
  100.     TQ3ViewObject        view,
  101.     TQ3ComputeBounds    computeBounds);
  102.  
  103. QD3D_EXPORT TQ3ViewStatus QD3D_CALL Q3View_EndBoundingSphere(
  104.     TQ3ViewObject        view,
  105.     TQ3BoundingSphere    *result);
  106.  
  107. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_StartPicking(
  108.     TQ3ViewObject        view,
  109.     TQ3PickObject        pick);
  110.  
  111. QD3D_EXPORT TQ3ViewStatus QD3D_CALL Q3View_EndPicking(
  112.     TQ3ViewObject        view);
  113.  
  114.  
  115. /******************************************************************************
  116.  **                                                                             **
  117.  **                            View/Camera routines                             **
  118.  **                                                                             **
  119.  *****************************************************************************/
  120.  
  121. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_GetCamera(
  122.     TQ3ViewObject        view,
  123.     TQ3CameraObject        *camera);
  124.  
  125. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_SetCamera(
  126.     TQ3ViewObject        view,
  127.     TQ3CameraObject        camera);
  128.  
  129. /******************************************************************************
  130.  **                                                                             **
  131.  **                            View/Lights routines                             **
  132.  **                                                                             **
  133.  *****************************************************************************/
  134.  
  135. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_SetLightGroup(
  136.     TQ3ViewObject        view,
  137.     TQ3GroupObject        lightGroup);
  138.  
  139. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_GetLightGroup(
  140.     TQ3ViewObject        view,
  141.     TQ3GroupObject        *lightGroup);
  142.  
  143. /******************************************************************************
  144.  **                                                                             **
  145.  **                                Idle Method                                     **
  146.  **                                                                             **
  147.  *****************************************************************************/
  148. /*
  149.  *    The idle methods allow the application to register callback routines 
  150.  *    which will be called by the view during especially long operations.
  151.  *
  152.  *    The idle methods may also be used to interrupt long renderings or
  153.  *    traversals.  Inside    the idler callback the application can check for
  154.  *    Command-Period, Control-C or clicking a "Cancel" button or whatever else
  155.  *    may be used to let the user interrupt rendering.    
  156.  *
  157.  *    It is NOT LEGAL to call QD3D routines inside an idler callback.
  158.  *
  159.  *    Return kQ3Failure to cancel rendering, kQ3Success to continue. Don't
  160.  *    bother posting an error.
  161.  *
  162.  *    Q3View_SetIdleMethod registers a callback that can be called
  163.  *    by the system during rendering.  Unfortunately there is no way yet
  164.  *    to set timer intervals when you want to be called.  Basically, it is
  165.  *    up to the application's idler callback to check clocks to see if you
  166.  *    were called back only a millisecond ago or an hour ago!
  167.  *
  168.  *    Q3View_SetIdleProgressMethod registers a callback that also gives
  169.  *    progress information. This information is supplied by the renderer, and
  170.  *    may or may not be based on real time.
  171.  *
  172.  *    If a renderer doesn't support the progress method, your method will be
  173.  *    called with current == 0 and completed == 0.
  174.  *    
  175.  *    Otherwise, you are GUARANTEED to get called at least 2 or more times:
  176.  *    
  177.  *    ONCE            idleMethod(view, 0, n)        -> Initialize, Show Dialog
  178.  *    zero or more    idleMethod(view, 1..n-1, n) -> Update progress
  179.  *    ONCE            idleMethod(view, n, n)        -> Exit, Hide Dialog
  180.  *    
  181.  *    "current" is guaranteed to be less than or equal to "completed"
  182.  *    "completed" may change values, but current/complete always indicates
  183.  *    the degree of completion.
  184.  *
  185.  *    The calling conventions aid in managing any data associated with a 
  186.  *    progress user interface indicator.
  187. */
  188.  
  189. typedef TQ3Status (QD3D_CALLBACK *TQ3ViewIdleMethod)(
  190.     TQ3ViewObject        view,
  191.     const void            *idlerData);
  192.  
  193. typedef TQ3Status (QD3D_CALLBACK *TQ3ViewIdleProgressMethod)(
  194.     TQ3ViewObject        view,
  195.     const void            *idlerData,
  196.     unsigned long        current,
  197.     unsigned long        completed);
  198.  
  199. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_SetIdleMethod(
  200.     TQ3ViewObject        view,
  201.     TQ3ViewIdleMethod    idleMethod,
  202.     const void             *idleData);
  203.  
  204. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_SetIdleProgressMethod(
  205.     TQ3ViewObject                view,
  206.     TQ3ViewIdleProgressMethod    idleMethod,
  207.     const void                     *idleData);
  208.  
  209. /******************************************************************************
  210.  **                                                                             **
  211.  **                                EndFrame Method                                 **
  212.  **                                                                             **
  213.  *****************************************************************************/
  214.  
  215. /*
  216.  *    The end frame method is an alternate way of determining when an
  217.  *    asynchronous renderer has completed rendering a frame. It differs from
  218.  *    Q3View_Sync in that notification of the frame completion is the opposite
  219.  *    direction. 
  220.  *    
  221.  *    With Q3View_Sync the application asks a renderer to finish rendering
  222.  *    a frame, and blocks until the frame is complete.
  223.  *    
  224.  *    With the EndFrame method, the renderer tells the application that is has
  225.  *    completed a frame.
  226.  *
  227.  *    If "Q3View_Sync" is called BEFORE this method has been called, this
  228.  *    method will NOT be called ever.
  229.  *    
  230.  *    If "Q3View_Sync" is called AFTER this method has been called, the
  231.  *    call will return immediately (as the frame has already been completed).
  232.  */
  233.  
  234. typedef void (QD3D_CALLBACK *TQ3ViewEndFrameMethod)(
  235.     TQ3ViewObject            view,
  236.     void                    *endFrameData);
  237.  
  238. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_SetEndFrameMethod(
  239.     TQ3ViewObject            view,
  240.     TQ3ViewEndFrameMethod    endFrame,
  241.     void                     *endFrameData);
  242.  
  243. /******************************************************************************
  244.  **                                                                             **
  245.  **                            Push/Pop routines                                 **
  246.  **                                                                             **
  247.  *****************************************************************************/
  248.  
  249. QD3D_EXPORT TQ3Status QD3D_CALL Q3Push_Submit(
  250.     TQ3ViewObject     view);
  251.  
  252. QD3D_EXPORT TQ3Status QD3D_CALL Q3Pop_Submit(
  253.     TQ3ViewObject     view);
  254.  
  255.  
  256. /******************************************************************************
  257.  **                                                                             **
  258.  **        Check if bounding box is visible in the viewing frustum.  Transforms **
  259.  **        the bbox by the current local_to_world transformation matrix and     **
  260.  **        does a clip test to see if it lies in the viewing frustum.             **
  261.  **        This can be used by applications to cull out large chunks of scenes     **
  262.  **        that are not going to be visible.                                     **
  263.  **                                                                             **
  264.  **        The default implementation is to always return kQ3True.  Renderers     **
  265.  **        may override this routine however to do the checking.                 **
  266.  **                                                                             **
  267.  *****************************************************************************/
  268.  
  269. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3View_IsBoundingBoxVisible(
  270.     TQ3ViewObject            view,
  271.     const TQ3BoundingBox    *bbox);
  272.  
  273.  
  274. /******************************************************************************
  275.  **                                                                             **
  276.  **                            DrawContext routines                             **
  277.  **                                                                             **
  278.  *****************************************************************************/
  279.  
  280. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_SetDrawContext(
  281.     TQ3ViewObject             view,
  282.     TQ3DrawContextObject    drawContext);
  283.  
  284. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_GetDrawContext(
  285.     TQ3ViewObject             view,
  286.     TQ3DrawContextObject    *drawContext);
  287.  
  288.  
  289. /******************************************************************************
  290.  **                                                                             **
  291.  **                            Graphics State routines                             **
  292.  **                                                                             **
  293.  ** The graphics state routines can only be called while rendering (ie. in     **
  294.  ** between calls to start and end rendering calls).  If they are called     **
  295.  ** outside of a rendering loop, they will return with error.                 **
  296.  **                                                                             **
  297.  *****************************************************************************/
  298.   
  299. /******************************************************************************
  300.  **                                                                             **
  301.  **                            Transform routines                                 **
  302.  **                                                                             **
  303.  *****************************************************************************/
  304.  
  305. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_GetLocalToWorldMatrixState(
  306.     TQ3ViewObject        view,
  307.     TQ3Matrix4x4        *matrix);
  308.         
  309. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_GetWorldToFrustumMatrixState(
  310.     TQ3ViewObject        view,
  311.     TQ3Matrix4x4        *matrix);
  312.         
  313. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_GetFrustumToWindowMatrixState(
  314.     TQ3ViewObject        view,
  315.     TQ3Matrix4x4        *matrix);
  316.     
  317.  
  318. /******************************************************************************
  319.  **                                                                             **
  320.  **                            Style state routines                             **
  321.  **                                                                             **
  322.  *****************************************************************************/
  323.  
  324. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_GetBackfacingStyleState(
  325.     TQ3ViewObject            view,
  326.     TQ3BackfacingStyle        *backfacingStyle);
  327.  
  328. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_GetInterpolationStyleState(
  329.     TQ3ViewObject            view,
  330.     TQ3InterpolationStyle    *interpolationType);
  331.  
  332. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_GetFillStyleState(
  333.     TQ3ViewObject            view,
  334.     TQ3FillStyle            *fillStyle);
  335.  
  336. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_GetHighlightStyleState(
  337.     TQ3ViewObject            view,
  338.     TQ3AttributeSet            *highlightStyle);
  339.  
  340. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_GetSubdivisionStyleState(
  341.     TQ3ViewObject            view,
  342.     TQ3SubdivisionStyleData    *subdivisionStyle);
  343.  
  344. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_GetOrientationStyleState(
  345.     TQ3ViewObject            view,
  346.     TQ3OrientationStyle        *fontFacingDirectionStyle);
  347.  
  348. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_GetReceiveShadowsStyleState(
  349.     TQ3ViewObject            view,
  350.     TQ3Boolean                *receives);
  351.  
  352. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_GetPickIDStyleState(
  353.     TQ3ViewObject            view,
  354.     unsigned long            *pickIDStyle);
  355.     
  356. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_GetPickPartsStyleState(
  357.     TQ3ViewObject            view,
  358.     TQ3PickParts            *pickPartsStyle);
  359.  
  360. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_GetAntiAliasStyleState(
  361.     TQ3ViewObject            view,
  362.     TQ3AntiAliasStyleData    *antiAliasData);
  363.     
  364.  
  365. /******************************************************************************
  366.  **                                                                             **
  367.  **                        Attribute state routines                             **
  368.  **                                                                             **
  369.  *****************************************************************************/
  370.  
  371. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_GetDefaultAttributeSet(
  372.     TQ3ViewObject        view,
  373.     TQ3AttributeSet        *attributeSet);
  374.  
  375. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_SetDefaultAttributeSet(
  376.     TQ3ViewObject        view,
  377.     TQ3AttributeSet        attributeSet);
  378.  
  379.  
  380. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_GetAttributeSetState(
  381.     TQ3ViewObject         view,
  382.     TQ3AttributeSet        *attributeSet);
  383.  
  384. QD3D_EXPORT TQ3Status QD3D_CALL Q3View_GetAttributeState(
  385.     TQ3ViewObject         view,
  386.     TQ3AttributeType    attributeType,
  387.     void                *data);
  388.  
  389. #ifdef __cplusplus
  390. }
  391. #endif    /* __cplusplus */
  392.  
  393. #if defined(THINK_C) || defined(__SC__)
  394.     #pragma SC options align=reset
  395. #elif defined(__MWERKS__)
  396.     #pragma enumsalwaysint reset
  397.     #pragma align_array_members reset
  398.     #pragma options align=reset
  399. #elif  defined(__PPCC__)
  400.     #pragma options align=reset
  401. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  402.     #pragma options enum=reset
  403. #endif
  404.  
  405. #endif  /*  QD3DView_h  */
  406.